SEVEN SEGMENT DISPLAY INTERFACING WITH RASPBERRY PI
In this experiment, we are going to interface Seven segment display with Raspberry Pi. There are total 9 buttons in seven segment display and each button is assigned a number from 1 to 9. Pressing any button will display its corresponding number on the 7-segment display. seven segment LED operates on two modes common anode and common cathode. In this project we have chosen common anode mode.
Synopsis:

In this experiment, we are going to interface Seven segment display with Raspberry Pi. There are total 9 buttons in seven segment display and each button is assigned a number from 1 to 9. Pressing any button will display its corresponding number on the 7-segment display. seven segment LED operates on two modes common anode and common cathode. In this project we have chosen common anode mode.

Description:


Seven segment display:

1. There are 8 LED present in seven segment display named as (a, b, c, d, e, f, g)

2. Low power consumption compared to LCD

3. Better, contrast and larger display than conventional LCD displays.

4. Current consumption: 30mA / segment

5. Peak current: 70mA.

6. Seven segment display will operate on 3.3 volts to +5 volts. In this project we are operating on 3.3V.


Raspberry Pi:

Raspberry Pi is a low cost, small size computer that plugs into a computer monitor, and uses a keyboard and mouse. It is capable device that enables us to explore computing and to learn how to program in languages like scratch and python. It is capable of doing what we expect a computer to do. It has many interfaces like HDMI, multiple USB, Ethernet, onboard Wi-Fi and Bluetooth, GPIOs, USB powered etc. also supports to LINUX, Python to make easy to build applications. Raspberry is available in different versions the latest version of Raspberry Pi is Pi3+ Model and the Updated version is Pi4 model. In Raspberry Pi 3B+ Model this model is having 64-bit quad core (processor) running at 1.4GHz, dual band 2.4GHz, 5GHz wireless LAN, Bluetooth 4.2/BLE, faster Ethernet, and PoE (power on Ethernet) capability with separate PoE HAT. Raspberry Pi3 Mode B+ maintains the same footprint as raspberry Pi2 and Raspberry Pi3 Model B.


Pin configuration:

1. Vin: Two 5v pins and two 3v3 pins used for providing power supply, where processor works on 3.3v.

2. Ground: Having 8 ground Pins which are un-configurable.

3. GPIO: There are 26 input-output pins which will be used as input or output based on programming.

4. PWM: In software PWM are available for all pins but in hardware PWM is available for GPIO12, GPIO13, GPIO18, and GPIO19.

5. 2 SPI bus: These pins are used for SPI communication the pins which are used for SPI is MISO, MOSI, SCLK, CE0, and CE1

6. I2C: These pins are used for I2C communication in which DATA and CLOCK pins are used for sending data to and from the SDA connection, with the speed controlled with SCL pin and ID-SE, ID-SC are reserved for ID EEPROM.

7. TX and RX: This pins are used for UART communication.

Seven segment pins connections with Raspberry pi:

1. Raspberry Pi GPIO-13 is connected to Pin ‘a’ of 7 segment display.

2. Raspberry Pi GPIO-6 is connected to Pin ‘b’ of 7 segment display.

3. Raspberry Pi GPIO-16 is connected to Pin ‘c’ of 7 segment display.

4. Raspberry Pi GPIO-20 is connected to Pin ‘d’ of 7 segment display.

5. Raspberry Pi GPIO-21 is connected to Pin ‘e’ of 7 segment display.

6. Raspberry Pi GPIO-19 is connected to Pin ‘f’ of 7 segment display.

7. Raspberry Pi GPIO-26 is connected to Pin ‘g’ of 7 segment display.

8. And common from 7 segment display is connected to 3.3v pin Raspberry Pi.

Schematic:


Code:

import RPi.GPIO as GPIO
import time
DISPLAY=[0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x67]
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(13,GPIO.OUT)
GPIO.setup(6,GPIO.OUT)
GPIO.setup(16,GPIO.OUT)
GPIO.setup(20,GPIO.OUT)
GPIO.setup(21,GPIO.OUT)
GPIO.setup(19,GPIO.OUT)
GPIO.setup(26,GPIO.OUT)
GPIO.setup(12,GPIO.OUT)
Def PORT(pin)
	if(pin&0x01==0x01):
		GPIO.output(13,1)
	else:
		GPIO.output(13,0)
	if(pin&0x02==0x02):
		GPIO.output(6,1)
	else:
		GPIO.output(6,0)
	if(pin&0x04==0x04):
		GPIO.output(16,1)
	else:
		GPIO.output(16,0)
	if(pin&0x08==0x08):
		GPIO.output(20,1)
	else:
		GPIO.output(20,0)
	if(pin&0x10==0x10):
		GPIO.output(21,1)
	else:
		GPIO.output(21,0)
	if(pin&0x20==0x20):
		GPIO.output(19,1)
	else:
		GPIO.output(19,0)
	if(pin&0x40==0x40):
		GPIO.output(26,1)
	else:
		GPIO.output(26,0)
	if(pin&0x80==0x80):
		GPIO.output(12,1)
	else:
		GPIO.output(12,0)
While 1:
	For x in range(10):
		Pin=DISPLAY[x]
		PORT(pin)
time.sleep(1)

Error message here!

Show Error message here!


Forgot your password?

Error message here!

Send OTP

Error message here!

Show Error message here!


Lost your password? Please enter your email address. You will receive a password you Need.

Send Error message here!


Back to log-in

Close